/*************************************************************************
 *
 * $Id: button.h 29 2006-06-29 16:03:33Z alpov $
 * 
 *************************************************************************/         

#ifndef _BUTTON_H
#define _BUTTON_H

#define BackLight(x) { if (x) PORTA &= ~_BV(PA7); else PORTA |= _BV(PA7); }
#define ReadKey() ((~PIND) & 0x0f)

#define KEY_FN      _BV(0)
#define KEY_SET     _BV(1)
#define KEY_PLUS    _BV(3)
#define KEY_MINUS   _BV(2)

#define KEY_ALL     (KEY_FN | KEY_SET | KEY_PLUS | KEY_MINUS)

#define BACKLIGHT_TIMEOUT   15000
#define BUTTON_FILTER       30
#define BUTTON_DELAY        600
#define BUTTON_REPEAT       150

AVRX_EXTERNTASK(ButtonTask);
extern void InitButtonTask(void);
extern void BackLightTimer(void);

#endif
